class Api::StoreStaffSalariesController < Api::BaseController
  before_action :set_staff, :set_salary
  def update
    @salary.update(store_staff_salary_params)
    render json: {status: true}
  end

  private
  def set_staff
    @staff = StoreStaff.find(params[:id])
  end

  def set_salary
    @salary = @staff.salary
  end

  def store_staff_salary_params
    params.require(:store_staff_salary).permit(
      :subsidy_amount,
      :insurance_amount,
      :attendence_amount,
      :discipline_amount,
      :debit_total,
      :reward_amount,
      :overtime_amount,
      :reward_total,
      :actual_amount,
      :status,
      subsidy: [
        :gangwei,
        :zhusu,
        :canfei,
        :laobao,
        :gaowen,
        :other
      ],
      insurance: [
        :yiliao,
        :shiye,
        :gongjijin,
        :yanglao
      ]
    )
  end
end
